#include <iostream>
#include "chapter14_winec.h"
#include "chapter14_person.h"
#include <ctime>

void Practice_14_1();
void Practice_14_4();
const int SIZE = 1;

//int main()
//{
//	Practice_14_4();
//	return 0;
//}

void Practice_14_1()
{
	using namespace std;
	cout << "Enter name of wine: ";
	char lab[50];
	cin.getline(lab, 50);
	cout << "Enter number of years: ";
	int yrs;
	cin >> yrs;

	Wine holding(lab, yrs);	//store label, years, give arrays yrs elements
	holding.GetBottles();//solicit input for year, bottle count
	holding.Show();//display object contents

	const int YRS = 3;
	int y[YRS] = { 1993, 1995, 1998 };
	int b[YRS] = { 48, 60, 72 };
	//create new object, initialize using data in arrays y and b
	Wine more("Gushing Grape Red", YRS, y, b);
	more.Show();
	cout << "Total bottles for " << more.Label()
		<< ": " << more.sum() << endl;
	cout << "Bye\n";
	return;
}

void Practice_14_4()
{
	using namespace std;

	srand(time(0));

	Person * ABC[SIZE];
	int i;
	for (i = 0; i < SIZE; i++)
	{
		char choice;
		cout << "Enter the Person category:\n"
			<< "g: GunsLinger p: PokerPlayer b: BadDude"
			<< "q: quit\n";
		cin >> choice;
		while (strchr("gpbq", choice) == NULL)
		{
			cout << "Please enter g p b q: ";
			cin >> choice;
		}
		if (choice == 'q')
			break;
		switch (choice)
		{
			case 'g': ABC[i] = new Gunslinger;
				break;
			case 'p': ABC[i] = new PokerPlayer;
				break;
			case 'b': ABC[i] = new BadDude;
				break;
		}
		cin.get();
		ABC[i]->Set();
	}
	cout << "\n Show All:\n";
	int ct;
	for (ct = 0; ct < i; ct++)
	{
		cout << endl;
		ABC[ct]->Show();
	}
	for (ct = 0; ct < i; ct++)
		delete ABC[ct];
	cout << "Bye.\n";

	return;
}

